<!DOCTYPE html>
<html lang="ch-CN">
<head>
    <meta charset="UTF-8">
    <title>实参类型</title>
</head>
<style>
    body {
        width: 100%;
        height: 100vh;
        background-color: wheat;
        font-size: 30px;
        text-decoration: none;
        font-family: "华文楷体";
    }
</style>
<script>
    //一： 以对象作为实参
    function say(object) {
        document.write("以对象作为实参:")
        document.write("<br>我是" + object.name + "今年" + object.age + "岁性别" + object.gender)
    }

    let obj = {
        name: "张三",
        age: "21",
        gender: "男"
    }
    say(obj);

    //二： 以字符串数字等作为实参
    function say1(name, age, gender) {
        document.write("<br><br>以字符串数字等作为实参:")
        document.write("<br>我是" + name + "今年" + age + "岁性别" + gender)
    }

    say1("小红", 21, "女");

    //三： 以函数做为实参
    function say2() {
        document.write("<br><br>以函数作为实参:")
        document.write("<br>我是" + obj1.name + "今年" + obj1.age + "岁性别" + obj1.gender)
    }

    // 形参为say2()函数
    function fun(fun1) {
        // 将obj1对象作为say2()函数的形参
        fun1(obj1)
    }

    // 对象
    let obj1 = {
        name: "小明",
        age: "45",
        gender: "男"
    }
    // 调用函数实参为函数
    fun(say2);
</script>
<body>
</body>
</html>